package com.copro.chemdb.stat.rule.export;

import java.util.Calendar;
import java.util.Date;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.contrib.HSSFCellUtil;

public class CellUtil extends HSSFCellUtil {
	public static HSSFCell createCell(HSSFRow row, int column, boolean value,
			HSSFCellStyle style) {
		HSSFCell cell = getCell(row, column);
		cell.setCellValue(value);
		if (style != null)
			cell.setCellStyle(style);
		return cell;
	}

	public static HSSFCell createCell(HSSFRow row, int column, boolean value) {
		return createCell(row, column, value, null);
	}

	public static HSSFCell createCell(HSSFRow row, int column, Calendar value,
			HSSFCellStyle style) {
		HSSFCell cell = getCell(row, column);
		cell.setCellValue(value);
		if (style != null)
			cell.setCellStyle(style);
		return cell;
	}

	public static HSSFCell createCell(HSSFRow row, int column, Calendar value) {
		return createCell(row, column, value, null);
	}

	public static HSSFCell createCell(HSSFRow row, int column, Date value,
			HSSFCellStyle style) {
		HSSFCell cell = getCell(row, column);
		cell.setCellValue(value);
		if (style != null)
			cell.setCellStyle(style);
		return cell;
	}

	public static HSSFCell createCell(HSSFRow row, int column, Date value) {
		return createCell(row, column, value, null);
	}

	public static HSSFCell createCell(HSSFRow row, int column, double value,
			HSSFCellStyle style) {
		HSSFCell cell = getCell(row, column);
		cell.setCellValue(value);
		if (style != null)
			cell.setCellStyle(style);
		return cell;
	}

	public static HSSFCell createCell(HSSFRow row, int column, double value) {
		return createCell(row, column, value, null);
	}

}
